// pages/userInfo/userInfo.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    userInfo:{}
  },


  onLoad: function (options) {
    this.setData({
      userInfo:wx.userInfo
    })
  },

  submit(){
    wx.put('http://localhost:3000/wx/member',this.data.userInfo).then(res => {
      console.log(res);
      wx.showToast({
        title: '修改用户信息成功',
        icon:'success',
        duration:2000
      })

      setTimeout(() => {
        wx.navigateBack({
          delta: -1,
        })
      },2000)

    })
  },

  getUserInfo(e){
    wx.getUserProfile({
      desc: '用于完善会员资料',
      success:res => {
        let userInfo = this.data.userInfo
        userInfo.nickName = res.userInfo.nickName
        userInfo.avatarUrl = res.userInfo.avatarUrl
        this.setData({
          userInfo
        })
      }
    })
  },

  onReady: function () {

  },


  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})